import config from 'config'
import httpFetch from 'share/httpFetch'
import errorMessage from 'share/errorMessage';

export default {

  //查询配置情况
  getConfig() {
    return httpFetch.get(`${config.baseUrl}/api/authorization/policy/role/config`)
  },

  //配置 超级管机员/财务 角色
  updateConfig(role, params) {
    return httpFetch.post(`${config.baseUrl}/api/authorization/policy/detail/batch/v2?permissionCode=${role}&authorizationCode=${role}`, params)
      .catch( (err) =>{
        errorMessage(err.response);
        throw(err);
      })
  },

  //获取验证码
  getBindMobileVerifiCode(params){
    return httpFetch.get(`${config.baseUrl}/api/refactor/set/mobile/token/v3`, params)
      .catch( (err) =>{
        errorMessage(err.response);
        throw(err);
      })
  },

  //完成配置（绑定手机）
  postConfig(params) {
    return httpFetch.post(`${config.baseUrl}/api/authorization/policy/role/config`, params)
  }

}
